package com.joker.aigc.chat.domain.vo;


import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.joker.aigc.chat.domain.dto.message.MessageExtra;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * Description: 消息
 * Author: <a href="https://github.com/zongzibinbin">abin</a>
 * Date: 2023-03-23
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MessageVo {

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "消息id")
    private Long id;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "房间")
    private Long roomId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "用户的id信息")
    private Long fromUid;

    @Schema(description = "消息内容")
    private String content;

    /**
     * 回复的消息内容
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "回复的消息内容的id")
    private Long replyMsgId;

    /**
     * 与回复的消息间隔多少条
     */
    @Schema(description = "与回复的消息间隔多少条")
    private Integer gapCount;

    /**
     * 消息类型 1正常文本 2.撤回消息
     */
    @Schema(description = "消息类型 1正常文本 2.撤回消息")
    private Integer type;

    /**
     * 扩展信息
     */
    @Schema(description = "扩展信息")
    private MessageExtra extra;

    @Schema(description = "用户姓名")
    private String username;

    @Schema(description = "用户头像")
    private String avatar;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

}
